package com.dy.course.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.dy.course.common.BaseController;
import com.dy.course.common.ResponseMessage;
import com.dy.course.entity.UpdateOrCreateUser;
import com.dy.course.model.User;
import com.dy.course.service.IUserService;

@Controller
public class LoginController extends BaseController{
	
	
	@Autowired
	private IUserService userService;

	@RequestMapping(value="/user/login",method=RequestMethod.POST)
	@ResponseBody
	public ResponseMessage<User> login(@RequestBody UpdateOrCreateUser user){
		logger.info("【登录】参数信息,user = "+JSON.toJSONString(user));
		return constructResponse(userService.login(user)); 
	}
}
